package com.vj.service.impl;

import com.vj.dao.BookDao;
import com.vj.dao.ZhujieDao;
import com.vj.service.BookService;
import com.vj.service.ZhujieService;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;

@Component
//@Repository
//@Controller
public class ZhujieServiceImpl implements ZhujieService, InitializingBean, DisposableBean {
    public BookDao bookDao;
//    public UserDao userDao;
    @Autowired//自动按类型装配
//    @Qualifier("ZhujieDao")//指定多个同类型类中的一个
    private ZhujieDao zhujieDao;

    public void see() {
        System.out.println("service Zhujie see");
//        bookDao.save();
//        bookDao.save();
        zhujieDao.talk();
    }

//    public BookServiceImpl(UserDao userDao) {
//        this.userDao = userDao;
//    }

    //提供对应set方法
    public void setBookDao(BookDao bookDao) {
        System.out.println("9999999999");
        this.bookDao = bookDao;
    }

    public void destroy() throws Exception {
        System.out.println("service book destroy");
    }

    public void afterPropertiesSet() throws Exception {
        System.out.println("service book afterPropertiesSet");
    }

//    public void setUserDao(UserDaoImpl userDao) {
//        this.userDao = userDao;
//    }
}
